import pandas as pd
import sklearn as sk
import numpy as np
from sklearn.preprocessing import StandardScaler

name = 'validation'
df = pd.read_csv(f'pima_{name}.csv')

columns = ['Glucose', 'BloodPressure', 'SkinThickness', 'Insulin', 'BMI']# 替换0为NaN
for col in columns:
    df[col] = df[col].replace(0, np.nan)

scaler = StandardScaler()

for col in columns:# 对数值特征标准化处理
    df[col] = scaler.fit_transform(df[[col]])

df.to_csv(f'pima_{name}_processed.csv', index=False)